Repository navigation
test: B2永続化spike(保存形式の検証とfixture) - #66
Open
Yuru-Yurufu wants to merge 1 commit into
Open
Yuru-Yurufu wants to merge 1 commit into
Yuru-Yurufu wants to merge 1 commit into
Conversation
Prove the versioned, filtered NbtHelper path for Double halves without wiring it into the Block Entities: registry and BlockTriple validation, property ownership, legacy ID-only reads, per-half loss and singleization, axis migration rules, and rate-limited diagnostics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
beta.4 Stage 1の B2永続化spike です。ダブルハーフの中のハーフ1枚ずつを、バージョン付きのNBTと相互に変換するcodecを作りました。Minecraft 1.21.1で方針どおりに動くかをGameTestで確かめています。
ゲームの動きは変えていません。 codecはgametest側(配布jarに入らない)にだけ置いています。本番のBlock Entityへの組み込みは、このspikeのレビュー後にStage 6で行います。
変更
gametest/persistence/ComponentStateCodec:書き込みと読み込みNbtHelper.fromBlockStateで書き、ハーフ自身の状態でないpropertyは取り除きます。取り除くのはTYPE、縦のFACING、SNOWY、DISTANCE、WATERLOGGED、is_doubleです。NbtHelper.toBlockStateに渡します。BlockTripleの形(横か縦か)positive_slab.id、negative_slab.id、axisもそのまま書くので、今のSlabeeでも読めます。axisに1回だけ保存します。gametest/persistence/Diagnostics:診断ログの件数を、一定時間ごとに上限で抑えます。PersistenceSpikeGameTests:21件ModBlockMap:読み取り専用のisMappedSlabとisMappedVerticalSlabを追加しました。main側の変更はこれだけです。確かめたこと(テスト)
SNOWYは保存しません。PERSISTENTは保存し、DISTANCEとWATERLOGGEDは保存しません。typeが書かれていても、スロットから決めた値を使います。idだけのNBTを読めます。axisを移行の入力にします。壊れていれば外側のBlockStateの軸、それもなければXです。versionで保存されたデータは、一緒に書かれている旧形式で読みます。./gradlew runGametest:41件すべて通過(うち新規21件)。./gradlew buildも通っています。Stage 6へ持ち越す気づき
NbtHelper.toBlockStateは、未知のidで黙ってairを返します。不正なproperty値はログに出すだけです。そのため、事前の検査が必要です。また、Identifier.ofは壊れたidで例外になるのでtryParseを使います。dirt_path_slab→dirt_slabはゲームのルールなので、codecには入れていません。facingは、今のコードでも使われていないので読んでいません。レビューのお願い
この方針でよければ、B2のgateを通過として、Stage 6の本実装を進められます。
🤖 Generated with Claude Code